package minijvm.print;

import minijvm.clz.ClassFile;

/**
 * @author ChangLiang
 * @date 2020/4/13
 */
public class ClassFilePrinter {

    private ClassFile classFile;

    public ClassFilePrinter(ClassFile classFile) {
        this.classFile = classFile;
    }

    public void print() {
        if(classFile.getAccessFlag().isPublicClass()){
            System.out.println("Access flag : public  ");
        }
        System.out.println("Class Name:"+ classFile.getClassName());

        System.out.println("Super Class Name:"+ classFile.getSuperClassName());

        System.out.println("minor version:" + classFile.getMinorVersion());

        System.out.println("major version:" + classFile.getMajorVersion());

        ConstantPoolPrinter printer = new ConstantPoolPrinter(classFile.getPool());
        printer.print();
    }
}
